package com.longe.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Controller
@RequestMapping("goods")
public class GoodsController {

    @RequestMapping("list")
    public String index(HttpServletRequest request,  Map<String, String> map){

        Cookie[] cookies = request.getCookies();
        if(null != cookies){
            for (Cookie cookie : cookies) {
                if(null != cookie && cookie.getName().equals("userName")){
                    map.put("userName", cookie.getValue());
                }
            }
        }

        return "goods-list";
    }
}
